package util

import (
	"encoding/json"
	"fmt"
	"io"
	"os"
)

func JsonReadFile(filename string, Result interface{}) error {
	dir, _ := os.Getwd()
	open, err := os.Open(dir + filename)
	if err != nil {
		fmt.Println(err)
		return err
	}
	buf, err := io.ReadAll(open)
	defer open.Close()
	err = json.Unmarshal(buf, Result)
	if err != nil {
		fmt.Println(err)
	}
	return err
}
